# Group Sponsors
Data related to the various sponsors with their level, url and images associated with a specific event.

| Parameter | Description | Type | Required |
|:----------|-------------|------|----------|
| `name`  | Name of the Sponsor | string | **yes** |
| `description` | Description of the sponsor | string | - |
| `url` | Url of the sponsor | string | - |
| `level` | Level of the sponsor | integer | - |
| `type` | The type of the sponsor | string | - |

## Sponsors Post Collection [/v1/sponsors]

### Create Sponsor [POST]
Create a new sponsor using an event_id.

+ Request (application/vnd.api+json)

    + Headers

            Authorization: JWT <Auth Key>

    + Body

            {
              "data": {
                "relationships":{
                  "event":{
                    "data":{
                      "type":"event",
                      "id":"1"
                    }
                  }
                },
                "attributes": {
                  "name": "Fossasia",
                  "description": "Fossasia",
                  "logo-url": "http://example.com/example.png",
                  "url": "http://example.com",
                  "level": "1",
                  "type": "Gold"
                },
                "type": "sponsor"
              }
            }


+ Response 201 (application/vnd.api+json)

        {
          "data": {
            "relationships": {
              "event": {
                "links": {
                  "self": "/v1/sponsors/1/relationships/event",
                  "related": "/v1/sponsors/1/event"
                }
              }
            },
            "attributes": {
              "description": "Fossasia",
              "level": "1",
              "url": "http://example.com",
              "logo-url": "http://example.com/example.png",
              "deleted-at": null,
              "type": "Gold",
              "name": "Fossasia"
            },
            "type": "sponsor",
            "id": "1",
            "links": {
              "self": "/v1/sponsors/1"
            }
          },
          "jsonapi": {
            "version": "1.0"
          },
          "links": {
            "self": "/v1/sponsors/1"
          }
        }

## Sponsors Get Collection [/v1/events/{event_identifier}/sponsors{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
+ Parameters
    + event_identifier: 1 (string) - identifier or event id of the event. (b8324ae2 is an example of identifier)
    + page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
    + page%5bnumber%5d (optional, integer, `2`) - Page number to fetched for the paginated response.
    + sort (optional, string, `level`) - Sort the resources according to the given attribute in ascending order. Append '-' to sort in descending order.
    + filter (optional, string, `[]`) - Filter according to the flask-rest-jsonapi filtering system. Please refer: http://flask-rest-jsonapi.readthedocs.io/en/latest/filtering.html for more.

### List All Sponsors [GET]
Get a list of Sponsors.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
          "meta": {
            "count": 1
          },
          "data": [
            {
              "relationships": {
                "event": {
                  "links": {
                    "self": "/v1/sponsors/1/relationships/event",
                    "related": "/v1/sponsors/1/event"
                  }
                }
              },
              "attributes": {
                "description": "Fossasia",
                "level": "1",
                "url": "http://example.com",
                "type": "Gold",
                "deleted-at": null,
                "logo-url": "http://example.com/example.png",
                "name": "Fossasia"
              },
              "type": "sponsor",
              "id": "1",
              "links": {
                "self": "/v1/sponsors/1"
              }
            }
          ],
          "jsonapi": {
            "version": "1.0"
          },
          "links": {
            "self": "/v1/events/1/sponsors"
          }
        }


## Sponsor Details [/v1/sponsors/{sponsor_id}]
+ Parameters
    + sponsor_id: 1 (integer) - ID of the sponsor in the form of an integer

### Sponsor Details [GET]
Get a single sponsor.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
          "data": {
            "relationships": {
              "event": {
                "links": {
                  "self": "/v1/sponsors/1/relationships/event",
                  "related": "/v1/sponsors/1/event"
                }
              }
            },
            "attributes": {
              "description": "Fossasia",
              "level": "1",
              "url": "http://example.com",
              "logo-url": "http://example.com/example.png",
              "deleted-at": null,
              "type": "Gold",
              "name": "Fossasia"
            },
            "type": "sponsor",
            "id": "1",
            "links": {
              "self": "/v1/sponsors/1"
            }
          },
          "jsonapi": {
            "version": "1.0"
          },
          "links": {
            "self": "/v1/sponsors/1"
          }
        }


### Update Sponsor [PATCH]
Update a single sponsor by `id`.

+ `id` (integer) - ID of the record to update **(required)**

+ Request (application/vnd.api+json)

    + Headers

            Authorization: JWT <Auth Key>

    + Body

            {
              "data": {
                "attributes": {
                  "description": "Example Description",
                  "url": "http://example1.com",
                  "level": "2",
                  "type": "Silver",
                  "name": "New Open Event Sponsor",
                  "logo-url": "http://example.com/example1.png"
                },
                "type": "sponsor",
                "id": "1"
              }
            }

+ Response 200 (application/vnd.api+json)

        {
          "data": {
            "relationships": {
              "event": {
                "links": {
                  "self": "/v1/sponsors/1/relationships/event",
                  "related": "/v1/sponsors/1/event"
                }
              }
            },
            "attributes": {
              "description": "Example Description",
              "level": "2",
              "url": "http://example.com",
              "logo-url": "http://example.com/example1.png",
              "deleted-at": null,
              "type": "Silver",
              "name": "New Open Event Sponsor"
            },
            "type": "sponsor",
            "id": "1",
            "links": {
              "self": "/v1/sponsors/1"
            }
          },
          "jsonapi": {
            "version": "1.0"
          },
          "links": {
            "self": "/v1/sponsors/1"
          }
        }

### Delete Sponsor [DELETE]
Delete a single sponsor.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
          "meta": {
            "message": "Object successfully deleted"
          },
          "jsonapi": {
            "version": "1.0"
          }
        }
